/*
*  与后端约定好的状态码
*  或全局通用的名词解释
*  如：订单状态、用户状态、用户类型约定
*  名称命名全大写
*/
const ORDER_STATUS = {
  0: "待付款",
  1: "已付款",
  2: "已收货",
};

//精确到时分秒的时间范围
const DATE_PICK_OPTION = {
  shortcuts: [{
    text: '最近一周',
    onClick(picker) {
      const end = new Date(new Date().toLocaleDateString()).getTime()+24*60*60*1000-1;
      const start = new Date(new Date().toLocaleDateString());
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
      picker.$emit('pick', [start, end]);
    }
  }, {
    text: '最近一个月',
    onClick(picker) {
      const end = new Date(new Date().toLocaleDateString()).getTime()+24*60*60*1000-1;
      const start = new Date(new Date().toLocaleDateString());
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
      picker.$emit('pick', [start, end]);
    }
  }, {
    text: '最近三个月',
    onClick(picker) {
      const end = new Date(new Date().toLocaleDateString()).getTime()+24*60*60*1000-1;
      const start = new Date(new Date().toLocaleDateString());
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
      picker.$emit('pick', [start, end]);
    }
  }]
}

export default {
  ORDER_STATUS,
  DATE_PICK_OPTION,
}